package string;


public class SubstringDemo {
    public static void main(String[] args) {
        //                      1
        //            01234567890
        String str = "www.tedu.cn";
        int start = 4;
        int end = 8;
        String name = str.substring(start,end); //截取下标4到7的字符串
        System.out.println(name); //tedu

        name = str.substring(str.indexOf("t"),str.lastIndexOf("."));
        System.out.println(name);
    }
}
